<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('attraction_user', function (Blueprint $table) {
            $table->comment('用户表');
            $table->integerIncrements('id')->nullable(false)->comment('用户ID')->unsigned();
            $table->string('username', 64)->nullable()->comment('用户名');
            $table->binary('avatar')->nullable()->comment('用户头像');
            $table->integer('times')->default(1)->comment('用户登录次数');
            $table->string('open_id', 128)->nullable()->comment('微信OpenID');
            $table->tinyInteger('status')->default(1)->comment('用户状态: 1正常, 2禁用');
            $table->index(['username'], 'username');
            $table->datetimes();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('attraction_user');
    }
};